<template>
	<view class="bg-white">
		<action-bar title="收入详情"></action-bar>
		<view>
			<amount-list 
				:header="false"
				:dataList="dataList"
				itemBgColor="bg-blue"
				:avatar="false"
				:record="true"
				:recordType="false"
				:arrow="false"
				amountTitle="recordAmount">
			</amount-list>
		</view>
		
	</view>
</template>

<script>
	export default {
		onShow() {
			this.curPage = 1
			this.hasNext = true
			this.dataList = []
			this.queryUserIncomeList()
		},
		onLoad(option) {
			this.user_id = option.userId
			this.book_id = option.bookId
			this.avatarUrl = option.avatarUrl
		},
		data() {
			return {
				user_id: null,
				book_id: null,
				avatarUrl: '',
				curPage: 1,
				hasNext: true,
				dataList: [],
			}
		},
		methods: {
			queryUserIncomeList() {
				if (this.hasNext) {
					this.$request({
						url: `/record/${this.book_id}/${this.user_id}/income/pn/${this.curPage}`
					}).then(res => {
						if (res && res.data.code == 200) {
							this.dataList = res.data.list
							this.hasNext = res.data.list.length >= this.$store.state.pageSize
							this.curPage ++
						}
					})
				}
			}
		}
	}
</script>

<style>
</style>
